import 'package:flutter/material.dart';

class ElevatedButtonWidget extends ElevatedButton {
  const ElevatedButtonWidget(
      {Key key,
        @required VoidCallback onPressed,
        VoidCallback onLongPress,
        ButtonStyle style,
        FocusNode focusNode,
        bool autofocus = false,
        Clip clipBehavior = Clip.none,
        @required Widget child,
        this.border,
        this.textColor,
        this.backgroundColor,
        this.elevation = 2.0,
        this.size})
      : super(
    key: key,
    onPressed: onPressed,
    onLongPress: onLongPress,
    style: style,
    focusNode: focusNode,
    autofocus: autofocus,
    clipBehavior: clipBehavior,
    child: child,
  );
  final OutlinedBorder border;
  final Color textColor;
  final Color backgroundColor;
  final double elevation;
  final Size size;

  @override
  // TODO: implement style
  ButtonStyle get style {
    if (border != null || size != null) {
      ButtonStyle oneStyle = ButtonStyle(
        shape: MaterialStateProperty.all(border),
        // foregroundColor: backgroundColor != null?MaterialStateProperty.all(backgroundColor): super.style.backgroundColor,
        foregroundColor: MaterialStateProperty.all(textColor),
        backgroundColor: MaterialStateProperty.all(backgroundColor),
        elevation: MaterialStateProperty.all(elevation),
        minimumSize: size != null ? MaterialStateProperty.all(size) : null,
      );
      return oneStyle;
    }
    return super.style;
  }
}